package com.tbvtc.agriculturalcreditchainserver2025.vo.ConsumerVo;

import com.fasterxml.jackson.annotation.JsonCreator;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.math.BigInteger;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.List;
@Data
public class ReportSumByTypeVo {
    @Schema(description = "报告个数")
    private BigInteger reportCount;
    @Schema(description = "报告名称")
    private List<String> reportName;
    @Schema(description = "报告时间")
    private List<String> reportTime;

    @JsonCreator
    public ReportSumByTypeVo(List<Object> array) {
        this.reportCount = (BigInteger) array.get(0);
        this.reportName= (List<String>) array.get(1);
        this.reportTime= getData((List<BigInteger>) array.get(2));


    }

    public List<String>  getData(List<BigInteger> reportTime){
        List<String> data = new ArrayList<>();
        reportTime.forEach(s->{
            String format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(s);
            data.add(format);
        });
         return data;
    }
}
